﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace Inline.SharePoint.SecurityOnViews.ConsoleApp
{

    class Program
    {

        static void Main(string[] args)
        {

            using (SPSite site = new SPSite("http://inlinesp2010dev"))
            {

                SPWebApplication webApp = site.WebApplication;

                for (int i = 0; i < webApp.WebConfigModifications.Count; i++)
                {

                    Console.WriteLine(webApp.WebConfigModifications[i].Name);

                }

                Console.WriteLine("Cleaning all modifications");

                for (int i = webApp.WebConfigModifications.Count - 1; i > -1; i--)
                {

                    Console.WriteLine("Deleting modification n° " + i);
                    webApp.WebConfigModifications.RemoveAt(i);

                }

                webApp.WebService.ApplyWebConfigModifications();
                webApp.Update();

            }

            Console.WriteLine("Done. Please press any key.");
            Console.Read();

        }

    }

}